package com.joysuch.wwyt.api.sync.simulate;

import com.alibaba.fastjson.JSONObject;
import com.joysuch.wwyt.api.sync.SyncResponse;
import com.joysuch.wwyt.api.sync.bean.BaseEquipmentBean;
import com.joysuch.wwyt.api.sync.bean.BaseEquipmentListBean;
import com.joysuch.wwyt.core.common.ajax.ResultBean;
import com.joysuch.wwyt.workflow.bean.WorkFlowTaskListBean;
import com.joysuch.wwyt.workflow.bean.WorkFlowTaskQueryBean;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.activiti.engine.ActivitiException;
import org.springframework.data.domain.Pageable;
import org.springframework.data.querydsl.QPageRequest;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.List;

/**
 *
 */

@Slf4j
@RestController
@RequestMapping("/api/test")
@Api(tags = "同步接口模拟数据")
@CrossOrigin
public class SyncSimulateDataController {

    @PostMapping("/equipmentList")
    @ApiOperation(value = "设备列表列表", response = SyncResponse.class)
    public SyncResponse equipmentList(@RequestBody String unitCode ) {
        BaseEquipmentListBean listBean = new BaseEquipmentListBean();
        List<BaseEquipmentBean> list = new ArrayList<>();
        BaseEquipmentBean bean = new BaseEquipmentBean();
        bean.setCode("T10001");
        bean.setDeviceTypeName("设备类型同步-1");
        bean.setName("蒸馏器");
        bean.setRefId("123");
        bean.setRefUrl("http://wwtest.joysuch.com/bp/production/getById?id=431");
        bean.setState(0);

        BaseEquipmentBean bean2 = new BaseEquipmentBean();
        bean2.setCode("T10002");
        bean2.setDeviceTypeName("设备类型同步-2");
        bean2.setName("蒸馏器2");
        bean2.setRefId("1232");
        bean2.setRefUrl("http://wwtest.joysuch.com/bp/production/getById?id=428");
        bean2.setState(2);

        BaseEquipmentBean bean3 = new BaseEquipmentBean();
        bean3.setCode("T10003");
        bean3.setDeviceTypeName("设备类型同步-3");
        bean3.setName("蒸馏器3");
        bean3.setRefId("1234");
        bean3.setRefUrl("http://wwtest.joysuch.com/bp/production/getById?id=428");
        bean3.setState(3);

        BaseEquipmentBean bean4 = new BaseEquipmentBean();
        bean4.setCode("T10004");
        bean4.setDeviceTypeName("设备类型同步-4");
        bean4.setName("蒸馏器4");
        bean4.setRefId("1232");
        bean4.setRefUrl("http://wwtest.joysuch.com/bp/production/getById?id=428");
        bean4.setState(4);

        BaseEquipmentBean bean5 = new BaseEquipmentBean();
        bean5.setCode("T10005");
        bean5.setDeviceTypeName("设备类型同步-5");
        bean5.setName("蒸馏器5");
        bean5.setRefId("1234");
        bean5.setRefUrl("http://wwtest.joysuch.com/bp/production/getById?id=428");
        bean5.setState(5);

        BaseEquipmentBean bean6 = new BaseEquipmentBean();
        bean6.setCode("T10006");
        bean6.setDeviceTypeName("设备类型同步-5");
        bean6.setName("蒸馏器6");
        bean6.setRefId("1234");
        bean6.setRefUrl("http://wwtest.joysuch.com/bp/production/getById?id=428");
        bean6.setState(6);


        BaseEquipmentBean bean7 = new BaseEquipmentBean();
        bean7.setCode("T10007");
        bean7.setDeviceTypeName("设备类型同步-5");
        bean7.setName("蒸馏器7");
        bean7.setRefId("1234");
        bean7.setRefUrl("http://wwtest.joysuch.com/bp/production/getById?id=428");
        bean7.setState(7);


        BaseEquipmentBean bean8 = new BaseEquipmentBean();
        bean8.setCode("T10008");
        bean8.setDeviceTypeName("设备类型同步-8");
        bean8.setName("蒸馏器8");
        bean8.setRefId("1234");
        bean8.setRefUrl("http://wwtest.joysuch.com/bp/production/getById?id=428");
        bean8.setState(8);


        list.add(bean);
        list.add(bean2);
        list.add(bean3);
        list.add(bean4);
        list.add(bean5);
        list.add(bean6);
        list.add(bean7);
        list.add(bean8);
        listBean.setContent(list);

        SyncResponse response = new SyncResponse();
        response.setMsg("success");
        response.setMsgcode("0");
        response.setData(JSONObject.toJSONString(listBean));

        return response;

    }
}
